package hu.codelab.lg.servicecenter.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.MotionEvent;

public class LGDialog extends Dialog {

    public interface OnTouchEventListener {

        void onTouchEvent(final Dialog dialog, final MotionEvent event);

    }

    private OnTouchEventListener onTouchEventListener;

    public LGDialog(final Context context, final boolean cancelable, final OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public LGDialog(final Context context, final int theme) {
        super(context, theme);
    }

    public LGDialog(final Context context) {
        super(context);
    }

    public OnTouchEventListener getOnTouchEventListener() {
        return onTouchEventListener;
    }

    public void setOnTouchEventListener(final OnTouchEventListener onTouchEventListener) {
        this.onTouchEventListener = onTouchEventListener;
    }

    @Override
    public boolean dispatchTouchEvent(final MotionEvent ev) {
        if (onTouchEventListener != null) {
            onTouchEventListener.onTouchEvent(this, ev);
        }

        return super.dispatchTouchEvent(ev);
    }

}
